{include file="styles/header.tpl"}
<link href="{$smarty.const.HOST_STATIC}/libs/js/calendar/calendar-mos.css" rel="stylesheet">
<script src="{$smarty.const.HOST_STATIC}/libs/js/calendar/calendar_mini.js"></script>
<script src="{$smarty.const.HOST_STATIC}/libs/js/calendar/init_cal.js"></script>
<script src="{$smarty.const.HOST_STATIC}/libs/js/calendar/lang/calendar-en.js"></script>

<div id="content" class="box">
	<h1>Upload Data</h1>
	{if $AppUI->admin_group_id==$smarty.const.GROUP_Administrator}
	<fieldset>
		<legend>Sale Data (CSV File)</legend>
		<form method="post" action="{$smarty.const.HOST_ADMIN}/post-data/save-sale" enctype="multipart/form-data" target="ifrmSaleData" onsubmit="return doSubmit();">
			<p class="msg error hide" id="null_saledata">File does not exists</p>
			<input type="file" name="file" size="120" readonly="true" />
			<label>Delimiter:</label> <input type="text" size="1" value="," name="strDelimiter" />
			<input type="submit" value="Upload Data" class="bt" />	
			<!--<input type="button" value="Reset Data" style="color:#FF0000" class="bt" onclick="doDelete(2);" />	-->
		</form>
		<a href="{$smarty.const.HOST_ADMIN}/common/download/?filename=SaleData.csv&p=/static/templates">Download Template File</a>
		<iframe name="ifrmSaleData" id="ifrmSaleData" width="100%" style="display:none"></iframe>
	</fieldset>
	
	{if $intTotalSale>0}
	<fieldset>
		<legend>Forecast Data (CSV File)</legend>
		<form method="post" action="{$smarty.const.HOST_ADMIN}/post-data/save" enctype="multipart/form-data" target="ifrmSave" onsubmit="return doSubmit();">
			<p class="msg error hide" id="null_forecastdata">File does not exists</p>
			<input type="file" name="file" size="120" readonly="true" />
			<label>Delimiter:</label> <input type="text" size="1" value="," name="strDelimiter" />
			<input type="submit" value="Upload Data" class="bt" />		
		</form>
		<a href="{$smarty.const.HOST_ADMIN}/common/download/?filename=ForecastData.csv&p=/static/templates">Download Template File</a>
		<iframe name="ifrmSave" id="ifrmSave" width="100%" style="display:none"></iframe>
	</fieldset>
	{/if}
	
	{if $AppUI->country=='vi'}
	<fieldset>
		<legend>Supplier Data (CSV File)</legend>
		<form method="post" action="{$smarty.const.HOST_ADMIN}/post-data/save-supplier" enctype="multipart/form-data" target="ifrmSupplier" onsubmit="return doSubmit();">
			<p class="msg error hide" id="null_supplier">File does not exists</p>
			<input type="file" name="file" size="120" readonly="true" />
			<label>Delimiter:</label> <input type="text" size="1" value="," name="strDelimiter" />
			<input type="submit" value="Upload Data" class="bt" />		
		</form>
		<a href="{$smarty.const.HOST_ADMIN}/common/download/?filename=SupplierData.csv&p=/static/templates">Download Template File</a>
		<iframe name="ifrmSave" id="ifrmSupplier" width="100%" style="display:none"></iframe>
	</fieldset>
	{/if}
	
	<p class="msg info">
		<span>Download the template file & convert to <strong>CSV</strong> file.</span>
	</p>
	{/if}
	
	{include file="post-data/index.paramater.tpl"}
</div>
<div id="currenttab" class="category_upload_data" style="display: none;">
{literal}
<script type="text/javascript">
	function doSubmit_Category()
	{
		showWaiting();
		return true;
	}
	
	function doSubmit()
	{
		showWaiting();
		return true;
	}
	
	function update_done()
	{
		alert('The process is done.');
		window.location.href = window.location.href;
		$.unblockUI();
	}
	
	function doDelete(v)
	{
		var msg	= 'This function will be deleted all the data. Are you sure?';
		if( confirm(msg) )
		{
			if(v==1){
				window.location.href	= HOST + '/post-data/reset-database/?callback=abc';
			}
			else{
				window.location.href	= HOST + '/post-data/reset-sale-database/?callback=abc';
			}
		}
	}
</script>
{/literal}

{include file="styles/footer.tpl"}